<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

	<style type="text/css">
	
	
		div{
		
			width: 100px;
			height: 100px;
			border: 1px solid red;
			color:red;
			
		
		}
	
	</style>
</head>
<body>
	<h4>Success</h4>
	
	<div id="div01">
	
	</div>
	
	<div >
	
		<table  id="userTable">
			<tr>
				<td>id</td>
				<td>手机号码</td>
				<td>密码</td>
			</tr>
		</table>
	
	</div>
	
	<div >
	
		<table  id="userTableList">
			<tr>
				<td>id</td>
				<td>手机号码</td>
				<td>密码</td>
			</tr>
		</table>
	
	</div>

</body>

	<!-- 军规：凡是路径 js css 请求 全部用绝对路径 webapp  -->
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.4.js" ></script>
	
	
	<script>
	
	
		$(function(){
			//后台发送请求  然后拿到游戏币的数量500
			$.ajax({
				'type':'post',
				'url':'${pageContext.request.contextPath}/user?method=getPlayCoin',
				'data':{
					'age':11,
					'year':2017,
				},
				'success':function(jsonData){
					var playCoin =  jsonData.playCoin;
					console.log(jsonData.playCoin);
					
					$('#div01').html(playCoin);
					
					var user= jsonData.user;
					
					var id       =user.id;
					var phone    =user.phone;
					var password =user.password;
					
					
					//逻辑思路 总的目标  在table  插入1个tr
					
					// 3个小目标      td 变化
					
					//1
					
					var td01 = $("<td>"+id+"</td>");
					var td02 = $("<td>"+phone+"</td>");
					var td03 = $("<td>"+password+"</td>");
					
					
					var tr = $("<tr></tr>");
					tr.append(td01);
					tr.append(td02);
					tr.append(td03);
					
					//
					$('#userTable').append(tr);
					
					//2
					
					
					//3
				},
				'dataType':'json',
			});
			
			
			
			
		});
	
	
	</script>
	
	
</html>